package com.jt.exe;

import com.jt.vo.SysResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.sql.SQLException;

//标识该类是全局异常处理机制
@RestControllerAdvice//返回值都是json串；通知：AOP技术，解决特定问题；特点：只拦截Controller层抛出的异常
//@ControllerAdvice//返回值是对象
public class SystemExe {
    @ExceptionHandler({RuntimeException.class, SQLException.class})
    public SysResult fail(){
        return SysResult.fail();
    }
}
